{extend name="common@base/common" /}

{block name="style"}
<link href="__CSS__/main.min.css" rel="stylesheet" type="text/css"/>
{/block}

{block name="body"}
<div class="container">
  <ol class="breadcrumb">
      <li><a href="{:url('index/index')}">演示首页</a></li>
      <li>仪表盘</li>
  </ol>
<section class="demo-section">
<div id="pageContent">



<article><p>仪表盘提供了一种灵活的方式来通过多个面板组（<code>.panel</code>）并配合栅格来展现内容的方式。</p><div class="alert alert-warning">
  <h4>兼容性提示</h4>
  <p>仪表盘视图在触摸屏上无法完成拖拽排序功能。</p>
</div></article>








<section><header><h3>使用示例</h3></header><article><h4>引入资源</h4><p>仪表盘为独立组件，你需要从本地或 CDN 单独引入 lib 目录下的资源：</p><pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="tag">&lt;link</span><span class="pln"> </span><span class="atn">href</span><span class="pun">=</span><span class="atv">"lib/dashboard/zui.dashboard.min.css"</span><span class="pln"> </span><span class="atn">rel</span><span class="pun">=</span><span class="atv">"stylesheet"</span><span class="tag">&gt;</span><span class="pln">
</span><span class="tag">&lt;script</span><span class="pln"> </span><span class="atn">src</span><span class="pun">=</span><span class="atv">"lib/dashboard/zui.dashboard.min.js"</span><span class="tag">&gt;&lt;/script&gt;</span></code></pre><h4>综合示例</h4><div style="padding-bottom: 0" class="example">
  <div id="dashboard" class="dashboard dashboard-draggable" data-height="300">
    <section class="row">
      <div class="col-md-4 col-sm-6">
        <div class="panel" data-id="1" id="panel1" style="height: 300px;">
          <div class="panel-heading">
            <i class="icon icon-list"></i>
            <span class="title">面板标题</span>
          </div>
          <div class="panel-body">
            <p>面板内容。</p>
          </div>
        </div>
      <div class="resize-handle resize-horizontal"><i class="icon icon-resize-h"></i></div><div class="resize-handle resize-vertical"><i class="icon icon-resize-v"></i></div></div>
      <div class="col-md-4 col-sm-6">
        <div class="panel" data-id="2" id="panel2" style="height: 300px;">
          <div class="panel-heading">
            <i class="icon icon-list"></i>
            <span class="title">包含列表组</span>
          </div>
          <div class="panel-body no-padding">
            <div class="list-group">
              <a href="" class="list-group-item">列表组项目1</a>
              <a href="" class="list-group-item">列表组项目2</a>
              <a href="" class="list-group-item">列表组项目3</a>
              <a href="" class="list-group-item">列表组项目4</a>
            </div>
          </div>
        </div>
      <div class="resize-handle resize-horizontal"><i class="icon icon-resize-h"></i></div><div class="resize-handle resize-vertical"><i class="icon icon-resize-v"></i></div></div>
      <div class="col-md-4 col-sm-6">
        <div class="panel" data-id="3" id="panel3" style="height: 300px;">
          <div class="panel-heading">
            <i class="icon icon-table"></i>
            <span class="title">包含表格</span>
          </div>
          <div class="panel-body no-padding">
           <table class="table">
            <thead>
              <tr>
                <th>ID</th>
                <th>名称</th>
                <th>积分</th>
                <th>排名</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>1526</td>
                <td>小马虎</td>
                <td>1056</td>
                <td class="text-red"><i class="icon icon-double-angle-up"></i> 1 </td>
              </tr>
              <tr>
                <td>1001</td>
                <td>勇敢的小鸭</td>
                <td>999</td>
                <td class="text-red"><i class="icon icon-double-angle-up"></i> 12 </td>
              </tr>
              <tr>
                <td>1045</td>
                <td>鸡大爷</td>
                <td>998</td>
                <td class="text-green"><i class="icon icon-double-angle-up"></i> 23 </td>
              </tr>
              <tr>
                <td>1025</td>
                <td>猪无畏</td>
                <td>860</td>
                <td class="text-green"><i class="icon icon-double-angle-down"></i> 25 </td>
              </tr>
              <tr>
                <td>1102</td>
                <td>糊涂虫</td>
                <td>749</td>
                <td class="text-red"><i class="icon icon-double-angle-up"></i> 30 </td>
              </tr>
            </tbody>
          </table>
          </div>
        </div>
      <div class="resize-handle resize-horizontal"><i class="icon icon-resize-h"></i></div><div class="resize-handle resize-vertical"><i class="icon icon-resize-v"></i></div></div>
      <div class="col-md-6">
        <div class="panel" data-id="4" id="panel4" style="height: 300px;">
          <div class="panel-heading">
            <i class="icon icon-bolt"></i>
            <span class="title">包含操作按钮</span>
            <div class="panel-actions">
              <a href="###" data-toggle="tooltip" title="" data-original-title="编辑"><i class="icon-pencil"></i></a>
              <button type="button" class="btn" data-toggle="tooltip" title="" data-original-title="收藏"><i class="icon-heart-empty"></i></button>
              <div class="dropdown" data-toggle="tooltip" title="" data-original-title="更多操作">
                <button class="btn" data-toggle="dropdown" type="button"><i class="icon icon-ellipsis-v"></i></button>
                <ul class="dropdown-menu pull-right">
                  <li><a href="###"><i class="icon icon-ok"></i> 确认</a></li>
                  <li><a href="###"><i class="icon icon-thumbs-o-up"></i> 自定义操作</a></li>
                </ul>
              </div>
            </div>
          </div>
          <div class="panel-body">
            <p>在面板头部（<code>.panel-heading</code>）包含链接和按钮来自定义操作。</p>
          </div>
        </div>
      <div class="resize-handle resize-horizontal"><i class="icon icon-resize-h"></i></div><div class="resize-handle resize-vertical"><i class="icon icon-resize-v"></i></div></div>
      <div class="col-md-6">
        <div class="panel" data-id="5" data-url="docs/partial/remote-panel.html" id="panel5" style="height: 300px;">
          <div class="panel-heading">
            <i class="icon icon-globe"></i>
            <span class="title">加载远程内容</span>
            <div class="panel-actions">
              <button type="button" class="btn refresh-panel" data-toggle="tooltip" title="" data-original-title="重新从远程获取内容"><i class="icon-refresh"></i></button>
            </div>
          </div>
          <div class="panel-body"><p>这些内容是通过 Ajax 从远程加载的。</p>
<p>点击头部右侧刷新按钮 <i class="icon-refresh icon"></i> 可以重新从远程获取内容。</p>
</div>
        </div>
      <div class="resize-handle resize-horizontal"><i class="icon icon-resize-h"></i></div><div class="resize-handle resize-vertical"><i class="icon icon-resize-v"></i></div></div>
      <div class="col-md-4 col-sm-6">
        <div class="panel" data-id="6" id="panel6" style="height: 300px;">
          <div class="panel-heading">
            <div class="title">可移除的面板</div>
            <div class="panel-actions">
              <button type="button" class="btn remove-panel" data-toggle="tooltip" title="" data-original-title="移除面板"><i class="icon-remove"></i></button>
            </div>
          </div>
          <div class="panel-body">
            <p>点击顶部右侧的 <i class="icon icon-remove"></i> 按钮来移除该面板。</p>
          </div>
        </div>
      <div class="resize-handle resize-horizontal"><i class="icon icon-resize-h"></i></div><div class="resize-handle resize-vertical"><i class="icon icon-resize-v"></i></div></div>
      <div class="col-md-8 col-sm-6">
        <div class="panel panel-loading" data-id="7" id="panel7" style="height: 300px;">
          <div class="panel-heading"><code>.panel-loading</code></div>
          <div class="panel-body">
            <p>为 <code>.panel</code> 添加 <code>.panel-loading</code> 类即可实现正在加载的外观。</p>
          </div>
        </div>
      <div class="resize-handle resize-horizontal"><i class="icon icon-resize-h"></i></div><div class="resize-handle resize-vertical"><i class="icon icon-resize-v"></i></div></div>
    </section>
  </div>
</div><pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"dashboard"</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"dashboard dashboard-draggable"</span><span class="pln"> </span><span class="atn">data-height</span><span class="pun">=</span><span class="atv">"300"</span><span class="tag">&gt;</span><span class="pln">
  </span><span class="tag">&lt;section</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"row"</span><span class="tag">&gt;</span><span class="pln">
    </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"col-md-4 col-sm-6"</span><span class="tag">&gt;</span><span class="pln">
      </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel"</span><span class="pln"> </span><span class="atn">data-id</span><span class="pun">=</span><span class="atv">"1"</span><span class="tag">&gt;</span><span class="pln">
        </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel-heading"</span><span class="tag">&gt;</span><span class="pln">
          </span><span class="tag">&lt;i</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"icon icon-list"</span><span class="tag">&gt;&lt;/i&gt;</span><span class="pln">
          </span><span class="tag">&lt;span</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"title"</span><span class="tag">&gt;</span><span class="pln">面板标题</span><span class="tag">&lt;/span&gt;</span><span class="pln">
        </span><span class="tag">&lt;/div&gt;</span><span class="pln">
        </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel-body"</span><span class="tag">&gt;</span><span class="pln">
          </span><span class="tag">&lt;p&gt;</span><span class="pln">面板内容。</span><span class="tag">&lt;/p&gt;</span><span class="pln">
        </span><span class="tag">&lt;/div&gt;</span><span class="pln">
      </span><span class="tag">&lt;/div&gt;</span><span class="pln">
    </span><span class="tag">&lt;/div&gt;</span><span class="pln">
    </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"col-md-4 col-sm-6"</span><span class="tag">&gt;</span><span class="pln">
      </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel"</span><span class="pln"> </span><span class="atn">data-id</span><span class="pun">=</span><span class="atv">"2"</span><span class="tag">&gt;</span><span class="pln">
        </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel-heading"</span><span class="tag">&gt;</span><span class="pln">
          </span><span class="tag">&lt;i</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"icon icon-list"</span><span class="tag">&gt;&lt;/i&gt;</span><span class="pln">
          </span><span class="tag">&lt;span</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"title"</span><span class="tag">&gt;</span><span class="pln">包含列表组</span><span class="tag">&lt;/span&gt;</span><span class="pln">
        </span><span class="tag">&lt;/div&gt;</span><span class="pln">
        </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel-body no-padding"</span><span class="tag">&gt;</span><span class="pln">
          </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"list-group"</span><span class="tag">&gt;</span><span class="pln">
            ...
          </span><span class="tag">&lt;/div&gt;</span><span class="pln">
        </span><span class="tag">&lt;/div&gt;</span><span class="pln">
      </span><span class="tag">&lt;/div&gt;</span><span class="pln">
    </span><span class="tag">&lt;/div&gt;</span><span class="pln">
    </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"col-md-4 col-sm-6"</span><span class="tag">&gt;</span><span class="pln">
      </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel"</span><span class="pln"> </span><span class="atn">data-id</span><span class="pun">=</span><span class="atv">"3"</span><span class="tag">&gt;</span><span class="pln">
        </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel-heading"</span><span class="tag">&gt;</span><span class="pln">
          </span><span class="tag">&lt;i</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"icon icon-table"</span><span class="tag">&gt;&lt;/i&gt;</span><span class="pln">
          </span><span class="tag">&lt;span</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"title"</span><span class="tag">&gt;</span><span class="pln">包含表格</span><span class="tag">&lt;/span&gt;</span><span class="pln">
        </span><span class="tag">&lt;/div&gt;</span><span class="pln">
        </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel-body no-padding"</span><span class="tag">&gt;</span><span class="pln">
          </span><span class="tag">&lt;table</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"table"</span><span class="tag">&gt;</span><span class="pln">
            ...
          </span><span class="tag">&lt;/table&gt;</span><span class="pln">
        </span><span class="tag">&lt;/div&gt;</span><span class="pln">
      </span><span class="tag">&lt;/div&gt;</span><span class="pln">
    </span><span class="tag">&lt;/div&gt;</span><span class="pln">
    </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"col-md-6"</span><span class="tag">&gt;</span><span class="pln">
      </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel"</span><span class="pln"> </span><span class="atn">data-id</span><span class="pun">=</span><span class="atv">"4"</span><span class="tag">&gt;</span><span class="pln">
        </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel-heading"</span><span class="tag">&gt;</span><span class="pln">
          </span><span class="tag">&lt;i</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"icon icon-bolt"</span><span class="tag">&gt;&lt;/i&gt;</span><span class="pln">
          </span><span class="tag">&lt;span</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"title"</span><span class="tag">&gt;</span><span class="pln">包含操作按钮</span><span class="tag">&lt;/span&gt;</span><span class="pln">
          </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel-actions"</span><span class="tag">&gt;</span><span class="pln">
            </span><span class="tag">&lt;a</span><span class="pln"> </span><span class="atn">href</span><span class="pun">=</span><span class="atv">"###"</span><span class="pln"> </span><span class="atn">data-toggle</span><span class="pun">=</span><span class="atv">"tooltip"</span><span class="pln"> </span><span class="atn">title</span><span class="pun">=</span><span class="atv">"编辑"</span><span class="tag">&gt;&lt;i</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"icon-pencil"</span><span class="tag">&gt;&lt;/i&gt;&lt;/a&gt;</span><span class="pln">
            </span><span class="tag">&lt;button</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"button"</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"btn"</span><span class="pln"> </span><span class="atn">data-toggle</span><span class="pun">=</span><span class="atv">"tooltip"</span><span class="pln"> </span><span class="atn">title</span><span class="pun">=</span><span class="atv">"收藏"</span><span class="tag">&gt;&lt;i</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"icon-heart-empty"</span><span class="tag">&gt;&lt;/i&gt;&lt;/button&gt;</span><span class="pln">
            </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"dropdown"</span><span class="pln"> </span><span class="atn">data-toggle</span><span class="pun">=</span><span class="atv">"tooltip"</span><span class="pln"> </span><span class="atn">title</span><span class="pun">=</span><span class="atv">"更多操作"</span><span class="tag">&gt;</span><span class="pln">
              </span><span class="tag">&lt;button</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"btn"</span><span class="pln"> </span><span class="atn">data-toggle</span><span class="pun">=</span><span class="atv">"dropdown"</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"button"</span><span class="tag">&gt;&lt;i</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"icon icon-ellipsis-v"</span><span class="tag">&gt;&lt;/i&gt;&lt;/button&gt;</span><span class="pln">
              </span><span class="tag">&lt;ul</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"dropdown-menu pull-right"</span><span class="tag">&gt;</span><span class="pln">
                </span><span class="tag">&lt;li&gt;&lt;a</span><span class="pln"> </span><span class="atn">href</span><span class="pun">=</span><span class="atv">"###"</span><span class="tag">&gt;&lt;i</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"icon icon-ok"</span><span class="tag">&gt;&lt;/i&gt;</span><span class="pln"> 确认</span><span class="tag">&lt;/a&gt;&lt;/li&gt;</span><span class="pln">
                </span><span class="tag">&lt;li&gt;&lt;a</span><span class="pln"> </span><span class="atn">href</span><span class="pun">=</span><span class="atv">"###"</span><span class="tag">&gt;&lt;i</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"icon icon-thumbs-o-up"</span><span class="tag">&gt;&lt;/i&gt;</span><span class="pln"> 自定义操作</span><span class="tag">&lt;/a&gt;&lt;/li&gt;</span><span class="pln">
              </span><span class="tag">&lt;/ul&gt;</span><span class="pln">
            </span><span class="tag">&lt;/div&gt;</span><span class="pln">
          </span><span class="tag">&lt;/div&gt;</span><span class="pln">
        </span><span class="tag">&lt;/div&gt;</span><span class="pln">
        </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel-body"</span><span class="tag">&gt;</span><span class="pln">
          </span><span class="tag">&lt;p&gt;</span><span class="pln">在面板头部（</span><span class="tag">&lt;code&gt;</span><span class="pln">.panel-heading</span><span class="tag">&lt;/code&gt;</span><span class="pln">）包含链接和按钮来自定义操作。</span><span class="tag">&lt;/p&gt;</span><span class="pln">
        </span><span class="tag">&lt;/div&gt;</span><span class="pln">
      </span><span class="tag">&lt;/div&gt;</span><span class="pln">
    </span><span class="tag">&lt;/div&gt;</span><span class="pln">
    </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"col-md-6"</span><span class="tag">&gt;</span><span class="pln">
      </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel"</span><span class="pln"> </span><span class="atn">data-id</span><span class="pun">=</span><span class="atv">"5"</span><span class="pln"> </span><span class="atn">data-url</span><span class="pun">=</span><span class="atv">"docs/partial/remote-panel.html"</span><span class="tag">&gt;</span><span class="pln">
        </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel-heading"</span><span class="tag">&gt;</span><span class="pln">
          </span><span class="tag">&lt;i</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"icon icon-globe"</span><span class="tag">&gt;&lt;/i&gt;</span><span class="pln">
          </span><span class="tag">&lt;span</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"title"</span><span class="tag">&gt;</span><span class="pln">加载远程内容</span><span class="tag">&lt;/span&gt;</span><span class="pln">
          </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel-actions"</span><span class="tag">&gt;</span><span class="pln">
            </span><span class="tag">&lt;button</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"button"</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"btn refresh-panel"</span><span class="pln"> </span><span class="atn">data-toggle</span><span class="pun">=</span><span class="atv">"tooltip"</span><span class="pln"> </span><span class="atn">title</span><span class="pun">=</span><span class="atv">"重新从远程获取内容"</span><span class="tag">&gt;&lt;i</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"icon-refresh"</span><span class="tag">&gt;&lt;/i&gt;&lt;/button&gt;</span><span class="pln">
          </span><span class="tag">&lt;/div&gt;</span><span class="pln">
        </span><span class="tag">&lt;/div&gt;</span><span class="pln">
        </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel-body"</span><span class="tag">&gt;</span><span class="pln">等待加载远程内容。</span><span class="tag">&lt;/div&gt;</span><span class="pln">
      </span><span class="tag">&lt;/div&gt;</span><span class="pln">
    </span><span class="tag">&lt;/div&gt;</span><span class="pln">
    </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"col-md-4 col-sm-6"</span><span class="tag">&gt;</span><span class="pln">
      </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel"</span><span class="pln"> </span><span class="atn">data-id</span><span class="pun">=</span><span class="atv">"6"</span><span class="tag">&gt;</span><span class="pln">
        </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel-heading"</span><span class="tag">&gt;</span><span class="pln">
          </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"title"</span><span class="tag">&gt;</span><span class="pln">可移除的面板</span><span class="tag">&lt;/div&gt;</span><span class="pln">
          </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel-actions"</span><span class="tag">&gt;</span><span class="pln">
            </span><span class="tag">&lt;button</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"button"</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"btn remove-panel"</span><span class="pln"> </span><span class="atn">data-toggle</span><span class="pun">=</span><span class="atv">"tooltip"</span><span class="pln"> </span><span class="atn">title</span><span class="pun">=</span><span class="atv">"移除面板"</span><span class="tag">&gt;&lt;i</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"icon-remove"</span><span class="tag">&gt;&lt;/i&gt;&lt;/button&gt;</span><span class="pln">
          </span><span class="tag">&lt;/div&gt;</span><span class="pln">
        </span><span class="tag">&lt;/div&gt;</span><span class="pln">
        </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel-body"</span><span class="tag">&gt;</span><span class="pln">
          </span><span class="tag">&lt;p&gt;</span><span class="pln">点击顶部右侧的 </span><span class="tag">&lt;i</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"icon icon-remove"</span><span class="tag">&gt;&lt;/i&gt;</span><span class="pln"> 按钮来移除该面板。</span><span class="tag">&lt;/p&gt;</span><span class="pln">
        </span><span class="tag">&lt;/div&gt;</span><span class="pln">
      </span><span class="tag">&lt;/div&gt;</span><span class="pln">
    </span><span class="tag">&lt;/div&gt;</span><span class="pln">
    </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"col-md-8 col-sm-6"</span><span class="tag">&gt;</span><span class="pln">
      </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel panel-loading"</span><span class="pln"> </span><span class="atn">data-id</span><span class="pun">=</span><span class="atv">"6"</span><span class="tag">&gt;</span><span class="pln">
        </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel-heading"</span><span class="tag">&gt;&lt;code&gt;</span><span class="pln">.panel-loading</span><span class="tag">&lt;/code&gt;&lt;/div&gt;</span><span class="pln">
        </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel-body"</span><span class="tag">&gt;</span><span class="pln">
          </span><span class="tag">&lt;p&gt;</span><span class="pln">为 </span><span class="tag">&lt;code&gt;</span><span class="pln">.panel</span><span class="tag">&lt;/code&gt;</span><span class="pln"> 添加 </span><span class="tag">&lt;code&gt;</span><span class="pln">.panel-loading</span><span class="tag">&lt;/code&gt;</span><span class="pln"> 类即可实现正在加载的外观。</span><span class="tag">&lt;/p&gt;</span><span class="pln">
        </span><span class="tag">&lt;/div&gt;</span><span class="pln">
      </span><span class="tag">&lt;/div&gt;</span><span class="pln">
    </span><span class="tag">&lt;/div&gt;</span><span class="pln">
  </span><span class="tag">&lt;/section&gt;</span><span class="pln">
</span><span class="tag">&lt;/div&gt;</span></code></pre><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="pln">$</span><span class="pun">(</span><span class="str">'#dashboard'</span><span class="pun">).</span><span class="pln">dashboard</span><span class="pun">({</span><span class="pln">draggable</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">});</span></code></pre></article></section>





<section><header><h3>选项</h3></header><article><p>在进行初始化时允许传入一个对象参数或者使用 <code>[data-*]</code> 属性作为初始化选项。可以使用的选项如下：</p><div class="table-responsive"><table class="table table-bordered">
  <thead>
    <tr>
      <th>选项</th>
      <th>名称</th>
      <th>可选值</th>
      <th>描述</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><code>height</code></td>
      <td>面板高度</td>
      <td>默认 <code>360</code></td>
      <td></td>
    </tr>
    <tr>
      <td><code>sensitive</code></td>
      <td>是否启用灵敏判断</td>
      <td><code>false</code>，<code>true</code>（默认）</td>
      <td>当设置为 <code>true</code> 时，在拖动面板时，即使鼠标没有移动可供放置的另一个面板区域内，如果此时被移动的面板影子元素已经与可供放置的一个面板有重合区域也会判断为可以放置在此面板区域内（执行重新排序操作）。</td>
    </tr>
    <tr>
      <td><code>draggable</code></td>
      <td>是否可以拖拽排序</td>
      <td><code>false</code>，<code>true</code>（默认）</td>
      <td>如果设定为 <code>true</code>，则用户可以拖拽面板头部（<code>.panel-heading</code>）来重新排列面板。</td>
    </tr>
    <tr>
      <td><code>resizable</code></td>
      <td>是否可以更改栅格大小</td>
      <td><code>false</code>，<code>true</code>（默认）</td>
      <td>如果设定为 <code>true</code>，则用户可以拖拽面板右侧边缘来动态更改栅格大小（决定面板宽度）。</td>
    </tr>
    <tr>
      <td><code>resizeMessage</code></td>
      <td>显示大小变更消息</td>
      <td><code>false</code>，<code>true</code>（默认）</td>
      <td>如果设定为 <code>true</code>，则在用户拖拽更改栅格大小时显示一个漂浮消息来指示当前栅格大小。</td>
    </tr>
    <tr>
      <td><code>data</code></td>
      <td>初始化面板</td>
      <td>对象数组</td>
      <td>指定一个对象数组用来在初始化时生成栅格和面板。</td>
    </tr>
    <tr>
      <td><code>onlyRefreshBody</code></td>
      <td>远程更新方式</td>
      <td><code>true</code>（默认）、<code>false</code></td>
      <td>如果设置为 <code>true</code>，则远程内容仅仅用于更新 <code>.panel-body</code> 元素，否则会更新 <code>.panel</code>。</td>
    </tr>
    <tr>
      <td><code>afterPanelRemoved</code></td>
      <td>面板被移除时的回调函数</td>
      <td>函数</td>
      <td>当用户点击 <code>.panel-actions</code> 内的 <code>.remove-panel</code> 元素时会移除面板并调用此回调函数。</td>
    </tr>
    <tr>
      <td><code>panelRemovingTip</code></td>
      <td>移除面板前的确认消息</td>
      <td><code>false</code>（默认）或用于格式化文本的字符串</td>
      <td>如果设置为一个字符串，则会在移除面板前弹出以此字符串作为消息的确认对话框，在字符串内包含格式化参数 <code>'{0}'</code> 来显示当前被移除的面板标题。</td>
    </tr>
    <tr>
      <td><code>afterOrdered</code></td>
      <td>重新排序面板后的回调函数</td>
      <td>函数</td>
      <td></td>
    </tr>
    <tr>
      <td><code>onResize</code></td>
      <td>更改栅格大小时的回调函数</td>
      <td>函数</td>
      <td></td>
    </tr>
    <tr>
      <td><code>afterRefresh</code></td>
      <td>远程加载完成后的回调函数</td>
      <td>函数</td>
      <td></td>
    </tr>
  </tbody>
</table></div><p>使用选项：</p><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="com">// 定义选项对象</span><span class="pln">
</span><span class="kwd">var</span><span class="pln"> options </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    height</span><span class="pun">:</span><span class="pln"> </span><span class="lit">400</span><span class="pun">,</span><span class="pln">
    afterOrdered</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">(</span><span class="pln">e</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
        console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="str">'排序完成：'</span><span class="pun">,</span><span class="pln"> e</span><span class="pun">);</span><span class="pln">
    </span><span class="pun">},</span><span class="pln">
    </span><span class="com">// 设置更多选项...</span><span class="pln">
</span><span class="pun">};</span><span class="pln">

</span><span class="com">// 初始化时传入选项参数</span><span class="pln">
$</span><span class="pun">(</span><span class="str">'#dashboard'</span><span class="pun">).</span><span class="pln">dashboard</span><span class="pun">(</span><span class="pln">options</span><span class="pun">)</span></code></pre></article></section>


















<section><header><h3>结构</h3></header><article><h4>使用面板</h4><p>面板（<code>.panel</code>）是仪表盘内用来展示内容的基本容器元素。</p><p>面板中的 <code>.panel-heading</code> 和 <code>.panel-body</code> 都是必须的。</p><p>默认情况下 <code>.panel-body</code> 包含内边距，如果需要移除外边距可以为 <code>.panel-body</code> 添加 <code>.no-padding</code> 类，这对于在 <code>.panel-body</code> 内直接包含 <code>&lt;table&gt;</code>、 <code>&lt;ul&gt;</code> 或 <code>.list-group</code> 等是必要的。</p><p>应该为每个面板定义 <code>[data-id]</code> 属性，其值为一个全局唯一的字符串，用来跟踪区块位置及其他操作。如果没有定义此属性则会在仪表盘初始化时生成随机的字符串作为标识。</p><h4>使用栅格</h4><p>表盘使用栅格系统来决定面板大小和排列方式。</p><p>在 <code>.dashboard</code> 内直接包含 <code>.row</code>，在 <code>.row</code> 内使用栅格修饰类 <code>.col-*</code> 作为面板容器。</p><p>所有栅格修饰类都是有效的，并且完全实现响应式设计。</p><h4>HTML 结构</h4><p>通过使用面板和栅格，你还需要配合特定类和结构来组织内容，一般形式如下：</p><pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"dashboard"</span><span class="tag">&gt;</span><span class="pln">
  </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"row"</span><span class="tag">&gt;</span><span class="pln">
    </span><span class="com">&lt;!-- 使用栅格 --&gt;</span><span class="pln">
    </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"col-md-6"</span><span class="tag">&gt;</span><span class="pln">
      </span><span class="com">&lt;!-- 面板，并为面板定义 data-id 属性 --&gt;</span><span class="pln">
      </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel"</span><span class="pln"> </span><span class="atn">data-id</span><span class="pun">=</span><span class="atv">"panel1"</span><span class="tag">&gt;</span><span class="pln">
        </span><span class="com">&lt;!-- 面板头部 --&gt;</span><span class="pln">
        </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel-heading"</span><span class="tag">&gt;</span><span class="pln">
          </span><span class="com">&lt;!-- 面板图标 --&gt;</span><span class="pln">
          </span><span class="tag">&lt;i</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"icon"</span><span class="tag">&gt;&lt;/i&gt;</span><span class="pln">
          </span><span class="com">&lt;!-- 面板标题 --&gt;</span><span class="pln">
          </span><span class="tag">&lt;span</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"title"</span><span class="tag">&gt;</span><span class="pln">标题</span><span class="tag">&lt;/span&gt;</span><span class="pln">
          </span><span class="com">&lt;!-- 面板操作按钮 --&gt;</span><span class="pln">
          </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel-actions"</span><span class="tag">&gt;</span><span class="pln">
            </span><span class="com">&lt;!-- 移除面板按钮 --&gt;</span><span class="pln">
            </span><span class="tag">&lt;a</span><span class="pln"> </span><span class="atn">href</span><span class="pun">=</span><span class="atv">""</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"remove-panel"</span><span class="tag">&gt;&lt;i</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"icon-remove"</span><span class="tag">&gt;&lt;/i&gt;&lt;/a&gt;</span><span class="pln">
            ...
          </span><span class="tag">&lt;/div&gt;</span><span class="pln">
        </span><span class="tag">&lt;/div&gt;</span><span class="pln">
        </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel-body"</span><span class="tag">&gt;</span><span class="pln">
          </span><span class="com">&lt;!-- 此处包含面板内容 --&gt;</span><span class="pln">
        </span><span class="tag">&lt;/div&gt;</span><span class="pln">
      </span><span class="tag">&lt;/div&gt;</span><span class="pln">
    </span><span class="tag">&lt;/div&gt;</span><span class="pln">
    </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"col-md-6"</span><span class="tag">&gt;</span><span class="pln">
      </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel"</span><span class="pln"> </span><span class="atn">data-id</span><span class="pun">=</span><span class="atv">"panel2"</span><span class="tag">&gt;</span><span class="pln">...</span><span class="tag">&lt;/div&gt;</span><span class="pln">
    </span><span class="tag">&lt;/div&gt;</span><span class="pln">
    ...
  </span><span class="tag">&lt;/div&gt;</span><span class="pln">
</span><span class="tag">&lt;/div&gt;</span></code></pre><h4>使用初始化数据</h4><p>在初始化仪表盘，指定 <code>data</code> 选项来动态生成仪表盘所需的 HTML 结构。<code>data</code> 选项为一个包含面板配置对象的数组。</p><pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"dashboard"</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"myDashboard"</span><span class="tag">&gt;&lt;/div&gt;</span></code></pre><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="com">// 定义所有面板的配置对象数组</span><span class="pln">
</span><span class="kwd">var</span><span class="pln"> data </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[{</span><span class="pln">
    id</span><span class="pun">:</span><span class="pln"> </span><span class="str">'panel1'</span><span class="pun">,</span><span class="pln">   </span><span class="com">// 面板编号</span><span class="pln">
    colWidth</span><span class="pun">:</span><span class="pln"> </span><span class="str">'4'</span><span class="pun">,</span><span class="pln">  </span><span class="com">// 栅格尺寸</span><span class="pln">
    url</span><span class="pun">:</span><span class="pln"> </span><span class="str">''</span><span class="pln">         </span><span class="com">// 设定面板远程内容更新地址</span><span class="pln">
</span><span class="pun">},</span><span class="pln"> </span><span class="pun">...]</span><span class="pln">

</span><span class="com">// 初始化</span><span class="pln">
$</span><span class="pun">(</span><span class="str">'#myDashboard'</span><span class="pun">).</span><span class="pln">dashboard</span><span class="pun">({</span><span class="pln">data</span><span class="pun">:</span><span class="pln"> data</span><span class="pun">});</span></code></pre><p>每一个面板配置对象可用属性包括：</p><ul>
<li><code>id</code>：全局唯一的面板编号；</li>
<li><code>colWidth</code>：栅格尺寸，可取值为 <code>1-12</code>；</li>
<li><code>url</code>：设定面板远程内容更新地址；</li>
<li><code>colAttrs</code>：设定栅格列元素的 HTML 属性，例如 <code>{title: ''}</code>；</li>
<li><code>panelAttrs</code>：设定面板元素的 HTML 属性，例如 <code>{title: ''}</code>；</li>
<li><code>content</code>：设定面板内 <code>.panel</code> 内所包含的 HTML 代码，也可用指定为一个函数来动态返回最终的 HTML 源码。</li>
</ul></article></section>



















<section><header><h3>用户个性化定制</h3></header><article><p>仪表盘提供了灵活的交互方式允许用户进行个性化组织面板内容，主要交互方式包括：</p><ul>
<li>排序：在面板头部（.panel-heading）按住鼠标不放并移动鼠标可以拖拽整个面板，将面板拖动到另一个面板所在位置可以更改面板显示的顺序；</li>
<li>更改大小：将鼠标悬停在面板右侧边缘位置，会出现面板大小更改提示图标，此时点按住边缘区域，并在水平方向上拖动鼠标，可以更改面板显示宽度（实际上是更改的面板所占据栅格的大小）。</li>
</ul><p>拖动时会在文档中插入被拖动面板元素的<strong>影子元素</strong>，会跟随鼠标光标位置，用于指示当前拖动的位置。</p><div class="alert alert-warning">
  <h4>需要注意</h4>
  <p>这些个性化定制选项在用户操作之后并没有存储下来，你需要在用户操作完成之后，保存这些个性化设置到服务器。</p>
</div><h4>处理个性化定制过程</h4><p>通过指定选项 <code>afterPanelRemoved</code>、<code>afterOrdered</code>、<code>onResize</code> 的回调函数来保存用户的个性化定制。</p><h4><span class="code">afterPanelRemoved</span></h4><p><code>afterPanelRemoved</code> 回调函数在面板被移除时调用，该回调函数包含一个参数 <code>id</code>，指示当前被移除的面板 ID。</p><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="pln">$</span><span class="pun">(</span><span class="str">'#myDashboard'</span><span class="pun">).</span><span class="pln">dashboard</span><span class="pun">{</span><span class="pln">
    afterPanelRemoved</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">(</span><span class="pln">id</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
        console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="str">'编号为'</span><span class="pun">,</span><span class="pln"> id</span><span class="pun">,</span><span class="pln"> </span><span class="str">'的面板被移除。'</span><span class="pun">);</span><span class="pln">
    </span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span></code></pre><h4><span class="code">afterOrdered</span></h4><p><code>afterOrdered</code> 回调函数在面板被重新排列时调用，该回调函数包含一个参数 <code>newOrders</code>，指示被排序的面板顺序。</p><p><code>newOrders</code> 参数为一个对象，其属性名称为面板变化，其值为对应面板的显示顺序。</p><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="pln">$</span><span class="pun">(</span><span class="str">'#myDashboard'</span><span class="pun">).</span><span class="pln">dashboard</span><span class="pun">{</span><span class="pln">
    afterOrdered</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">(</span><span class="pln">newOrders</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
        console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="str">'当前面板被重新排序，新的顺序为'</span><span class="pun">,</span><span class="pln"> newOrders</span><span class="pun">);</span><span class="pln">
    </span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span></code></pre><h4><span class="code">onResize</span></h4><p><code>onResize</code> 回调函数在面板所在栅格列大小被更改时调用，该回调函数包含一个参数 <code>e</code>，该参数拥有的属性如下：</p><ul>
<li><code>e.element</code>：当前被更改的栅格元素；</li>
<li><code>e.id</code>：当前栅格包含的面板的编号；</li>
<li><code>e.grid</code>：更改后的栅格大小；</li>
<li><code>e.old</code>：更改之前的栅格大小；</li>
<li><code>e.revert</code>：一个回调函数，调用此回调函数可以撤销栅格变更操作。</li>
</ul><p>通过在回调函数内调用 <code>e.revert()</code> 可以撤销栅格变更操作，也可以在回调函数内返回 <code>false</code> 来实现撤销操作。</p><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="pln">$</span><span class="pun">(</span><span class="str">'#myDashboard'</span><span class="pun">).</span><span class="pln">dashboard</span><span class="pun">{</span><span class="pln">
    onResize</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">(</span><span class="pln">e</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
        console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="str">'当前面板栅格大小被更改为'</span><span class="pun">,</span><span class="pln"> e</span><span class="pun">.</span><span class="pln">grid</span><span class="pun">);</span><span class="pln">
    </span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span></code></pre></article></section>






<section><header><h3>操作按钮</h3></header><article><p>每个面板的 <code>.panel-heading</code> 内都可以直接包含一个 <code>.panel-actions</code>。在 <code>.panel-actions</code> 可以包含若干个链接或按钮，甚至是下拉菜单 <code>.dropdown</code>。</p><pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel-heading"</span><span class="tag">&gt;</span><span class="pln">
  ...
  </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel-actions"</span><span class="tag">&gt;</span><span class="pln">
    </span><span class="tag">&lt;a</span><span class="pln"> </span><span class="atn">href</span><span class="pun">=</span><span class="atv">"###"</span><span class="pln"> </span><span class="atn">data-toggle</span><span class="pun">=</span><span class="atv">"tooltip"</span><span class="pln"> </span><span class="atn">title</span><span class="pun">=</span><span class="atv">"编辑"</span><span class="tag">&gt;&lt;i</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"icon-pencil"</span><span class="tag">&gt;&lt;/i&gt;&lt;/a&gt;</span><span class="pln">
    </span><span class="tag">&lt;button</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"button"</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"btn"</span><span class="pln"> </span><span class="atn">data-toggle</span><span class="pun">=</span><span class="atv">"tooltip"</span><span class="pln"> </span><span class="atn">title</span><span class="pun">=</span><span class="atv">"收藏"</span><span class="tag">&gt;&lt;i</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"icon-heart-empty"</span><span class="tag">&gt;&lt;/i&gt;&lt;/button&gt;</span><span class="pln">
    </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"dropdown"</span><span class="pln"> </span><span class="atn">data-toggle</span><span class="pun">=</span><span class="atv">"tooltip"</span><span class="pln"> </span><span class="atn">title</span><span class="pun">=</span><span class="atv">"更多操作"</span><span class="tag">&gt;</span><span class="pln">
      </span><span class="tag">&lt;button</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"btn"</span><span class="pln"> </span><span class="atn">data-toggle</span><span class="pun">=</span><span class="atv">"dropdown"</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"button"</span><span class="tag">&gt;&lt;i</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"icon icon-ellipsis-v"</span><span class="tag">&gt;&lt;/i&gt;&lt;/button&gt;</span><span class="pln">
      </span><span class="tag">&lt;ul</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"dropdown-menu pull-right"</span><span class="tag">&gt;</span><span class="pln">
        </span><span class="tag">&lt;li&gt;&lt;a</span><span class="pln"> </span><span class="atn">href</span><span class="pun">=</span><span class="atv">"###"</span><span class="tag">&gt;&lt;i</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"icon icon-ok"</span><span class="tag">&gt;&lt;/i&gt;</span><span class="pln"> 确认</span><span class="tag">&lt;/a&gt;&lt;/li&gt;</span><span class="pln">
        </span><span class="tag">&lt;li&gt;&lt;a</span><span class="pln"> </span><span class="atn">href</span><span class="pun">=</span><span class="atv">"###"</span><span class="tag">&gt;&lt;i</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"icon icon-thumbs-o-up"</span><span class="tag">&gt;&lt;/i&gt;</span><span class="pln"> 自定义操作</span><span class="tag">&lt;/a&gt;&lt;/li&gt;</span><span class="pln">
      </span><span class="tag">&lt;/ul&gt;</span><span class="pln">
    </span><span class="tag">&lt;/div&gt;</span><span class="pln">
  </span><span class="tag">&lt;/div&gt;</span><span class="pln">
</span><span class="tag">&lt;/div&gt;</span></code></pre><p>如果为 <code>.panel-actions</code> 内的链接（<code>&lt;a&gt;</code>）和按钮（<code>.btn</code>）设置特殊类，则用户点击这些按钮时会执行特殊操作。这些特殊类和操作定义如下：</p><ul>
<li><code>.remove-panel</code>：移除当前面板；</li>
<li><code>.refresh-panel</code>：从远程重新加载内容。</li>
</ul><div class="alert alert-warning">
  <h4>需要注意</h4>
  <p>这些用户执行这些操作之后并没有进行持久化工作，你需要在用户操作完成之后，保存这些个性化设置到服务器。</p>
</div></article></section>














<script src="__ZUI__/lib/dashboard/zui.dashboard.js"></script>

<script>
function onPageLoad() {
    if($.fn.dashboard) $('#dashboard').dashboard({
        shadowType: 'normal', 
        afterOrdered: function(orders) {
            console.log(orders);
        }
    });
}
</script><section><header><h3>从远程加载</h3></header><article><p>每个面板的内容（<code>.panel-body</code>）都可以实现自动以给定的地址从远程加载。只需要为 <code>.panel</code> 添加 <code>[data-url]</code> 属性，属性值为远程加载的地址。</p><pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel"</span><span class="pln"> </span><span class="atn">data-url</span><span class="pun">=</span><span class="atv">"path/to/panel/content"</span><span class="tag">&gt;</span><span class="pln">
  </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel-heading"</span><span class="tag">&gt;</span><span class="pln">
    ...
  </span><span class="tag">&lt;/div&gt;</span><span class="pln">
  </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"panel-body"</span><span class="tag">&gt;</span><span class="pln">
    ...
  </span><span class="tag">&lt;/div&gt;</span><span class="pln">
</span><span class="tag">&lt;/div&gt;</span></code></pre><p>当添加了 <code>[data-url]</code> 属性之后，在仪表盘初始化之后会立即尝试从此地址获取内容并更新到 <code>.panel-body</code> 内。</p><p>如果 <code>.panel-actions</code> 包含 <code>.refresh-panel</code> 按钮，则点击此按钮也会进行更新操作。</p><h4><span class="code">afterRefresh</span></h4><p>通过选项指定的 <code>afterRefresh</code> 回调函数来跟踪远程更新操作，该回调函数包含一个参数 <code>e</code>，该参数拥有的属性如下：</p><ul>
<li><code>e.result</code>：指示远程请求操作是否执行成功；</li>
<li><code>e.data</code>：从远处获取到的用于更新面板的内容。</li>
</ul><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="pln">$</span><span class="pun">(</span><span class="str">'#myDashboard'</span><span class="pun">).</span><span class="pln">dashboard</span><span class="pun">{</span><span class="pln">
    afterRefresh</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">(</span><span class="pln">e</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
        console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="str">'从远程更新的结果为'</span><span class="pun">,</span><span class="pln"> e</span><span class="pun">.</span><span class="kwd">true</span><span class="pun">);</span><span class="pln">
    </span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span></code></pre><h4>手动执行远程更新请求</h4><p>用户除了可以通过点击 <code>.refresh-panel</code> 元素来执行远程更新请求，还可以手动调用仪表盘实例上的 <code>refresh()</code> 方法来执行远程更新。</p><p>该方法形式如下：</p><ul>
<li><code>refresh(panel)</code></li>
<li><code>refresh(panel, onlyRefreshBody)</code></li>
</ul><p>其中 <code>panel</code> 参数使用 CSS 选择器指定为需要进行更新的面板（<code>.panel</code>）对象；<code>onlyRefreshBody</code> 参数为布尔值，指定是否仅仅使用远程内容来更新 <code>.panel-body</code> 元素。</p><pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="com">// 获取仪表盘实例</span><span class="pln">
</span><span class="kwd">var</span><span class="pln"> myDashboard </span><span class="pun">=</span><span class="pln"> $</span><span class="pun">(</span><span class="str">'#myDashboard'</span><span class="pun">).</span><span class="pln">data</span><span class="pun">(</span><span class="str">'zui.dashboard'</span><span class="pun">);</span><span class="pln">

</span><span class="com">// 执行远程更新请求</span><span class="pln">
myDashboard</span><span class="pun">.</span><span class="pln">refresh</span><span class="pun">(</span><span class="str">'#myPanel1'</span><span class="pun">);</span></code></pre><link href="__ZUI__/lib/dashboard/zui.dashboard.css" rel="stylesheet"></article></section></div>


</section>
{/block}